package com.qing.design.patterns.singleton.example.non_thread_safe;

public class Singleton {

	private static Singleton singleton;

	public  String value;

	private Singleton(String value) {

		try {
			//下面的代码模拟缓慢的初始化。
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		this.value=value;
	}

	public static Singleton getInstance(String value){
		if(singleton==null){
			singleton=new Singleton(value);
		}
		return singleton;
	}
}
